<!doctype html>
<html class="no-js fixed-layout">
<head>
  <!-- 公共head Begin -->
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="keywords" content="萌宠之家-C2B2C社会化电商平台" />
  <meta name="description" content="《萌宠之家-C2B2C社会化电商平台》是一个基于宠物社区的一站式电商平台。" />
  <!-- minimum-scale=1.0, maximum-scale=1.0 不加这两个在iPhone浏览器下点击缩小了的输入框会使整个页面变大 -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
  <title>萌宠之家-C2B2C社会化电商平台</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <link rel="icon" type="image/png" href="statics/img/favicon.png">

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="icon" sizes="192x192" href="statics/img/app-icon72x72@2x.png">

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Pet Mall"/>
  <link rel="apple-touch-icon-precomposed" href="statics/img/app-icon72x72@2x.png">

  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileImage" content="statics/img/app-icon72x72@2x.png">
  <meta name="msapplication-TileColor" content="#0e90d2">

  <link rel="stylesheet" href="statics/AmazeUI/assets/css/amazeui.min.css">
  <link rel="stylesheet" href="statics/AmazeUI/assets/css/shop.css">

  <!--[if (gte IE 9)|!(IE)]><!-->
  <script src="statics/AmazeUI/assets/js/jquery.min.js"></script>
  <!--<![endif]-->

  <script src="statics/js/plugin/jquery.cookie.js"></script>

  <!-- 此处form的导入和amazeui.min.js会有冲突，请根据需要使用 -->
  <script src="statics/js/plugin/jquery.form.js"></script>

  <script src="statics/js/jquery.lSelect.js"></script>
  <script src="statics/js/plugin/jquery.metadata.js"></script>
  <script src="statics/js/product.js"></script>
  <!-- 公共head End -->
</head>
<body>
<!-- 网页头部 Begin -->
<div class="header"></div>
<!-- 网页头部 End -->
<div class="am-cf shop-main">
  <!-- content start -->
  <div class="shop-content">
    <div class="shop-content-body">
      <div class="am-margin am-text-xs">
        <div class="am-panel am-panel-default">
          <div class="am-panel-bd">
            <div class="am-text-warning am-text-lg"><span class="am-icon-check am-icon-lg">&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;您的订单已经成功提交！</div>
          </div>
        </div>
        <div class="am-panel am-panel-default">
          <div class="am-panel-hd">
            <h4 class="am-panel-title">
              订单信息
            </h4>
          </div>
          <div class="am-panel-bd am-g am-padding-0">
            <table class="am-table am-table-bordered am-table-compact am-text-nowrap am-margin-0">
              <tbody>
              <tr>
                <th>订单编号</th>
                <td>
                  <span id="lblOrderNo">-</span>
                  &emsp;<a id="aOrderId" class="am-badge am-badge-primary" href="javascript:void(0);">查看订单详情</a>
                </td>
              </tr>
              <tr>
                <th>订单总金额</th>
                <td>
                  <strong id="lblPayment" class="am-text-danger">-</strong>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
        <div class="am-panel am-panel-default">
          <div class="am-panel-hd">
            <h4 class="am-panel-title">
              配送信息
            </h4>
          </div>
          <div class="am-panel-bd am-g am-padding-0">
            <table class="am-table am-table-bordered am-table-compact am-text-nowrap am-margin-0">
              <tbody>
              <tr>
                <th>配送方式</th>
                <td>
                  科泰宠物托运中心
                  &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>

        <div class="am-panel am-panel-default">
          <div class="am-panel-hd">
            <h4 class="am-panel-title">
              支付信息
            </h4>
          </div>
          <div class="am-panel-bd am-g am-padding-0">
            <table class="am-table am-table-bordered am-table-compact am-text-nowrap am-margin-0">
              <tbody>
              <tr>
                <th>支付方式</th>
                <td>
                  支付宝
                  &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
                </td>
              </tr>
              <tr>
                <th></th>
                <td>
                  <button id="btnPay" type="button" class="am-btn am-btn-primary am-btn-xs">立即支付</button>&emsp;&emsp;
                  <button type="button" class="am-btn am-btn-default am-btn-xs" onclick="window.location.href='member_receiver_order_list.html'">我的订单</button>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- content end -->
</div>
</body>
<script src="statics/AmazeUI/assets/js/amazeui.min.js"></script>
<script src="statics/AmazeUI/assets/js/amazeui.modal.js"></script>
<script src="statics/js/base.js"></script>
<script src="statics/AmazeUI/assets/js/validator.js"></script>
<script type="text/javascript">

    let jsonUser;
    let token;

    // 订单id
    let orderId = GetQueryString('id');

    $().ready( function() {

        // 判断用户信息和token是否存在
        jsonUser = sessionStorage.getItem("user");
        token = sessionStorage.getItem("token");

        // 加载公共顶部模板
        $('.header').load('header.html');

        // '立即支付'按钮事件
        $('#btnPay').click(function () {

            // 跳转到支付确认界面
            top.location.href = 'payment_confirm.html?id=' + orderId;

        });// $('#btnPay').click();

        // 查看是否存在订单id
        if( orderId ) {
            // 如果存在订单id，就加载订单信息
            loadOrderInfo();
        }

    });// $().ready();

/** 根据订单id，查找订单信息 **/
function loadOrderInfo(){

    // 加载'商品信息'数据
    $.ajax({
        type: 'POST',
        url: 'http://localhost:8080/order/get',
        async: false,
        data: {
            token: token,
            id:orderId
        },
        success: function (result) {

            // 如果返回的数据的响应码不是'成功(200)'
            if (result.code != 200) {
                Modal.alert(result.msg);
                return;
            }

            // 如果返回的数据响应码为200
            // 填充订单信息数据
            fillOrderInfo(result.data);
        }

    });// $.ajax();

}// loadOrderInfo();

/** 填充订单信息 **/
function fillOrderInfo( order ) {

    // 订单编号
    $('#lblOrderNo').html(order.orderNo);

    // 订单总金额
    $('#lblPayment').html( priceCurrencyFormat(order.payment) );

    // '查看订单详情'按钮
    $('#aOrderId').attr('href', 'member_order_view.html?id=' + orderId);

}// fillOrderInfo( order );

</script>
</html>